<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        *{
            padding: 5px;
        }
        #d1{
            width: 600px;
            margin: 0px auto;
            text-align: center;
        }
    </style>
    <script type="text/javascript" th:src="@{js/jquery-1.12.4.js}"></script>
    <script type="text/javascript">
        $(function(){
            $.post("show",function (data){
                var tab = $("#tab");
                var tr = "";
                $.each(data,function (index,item){
                    tr+="<tr><td>"+item.title+"</td><td>"+item.summary+"</td><td>"+item.author+"</td><td>"+item.ptime+"</td><td><a href='tohuifu?pid="+item.pid+"'>查看回复</a></td></tr>";
                })
                tab.append(tr);
                $("tr:odd").css("background","#A3CAFB");
            },"json");
            if([[${session.page.getPageNum()}]]<=1){
                $("#a2").hide();
            }
            if([[${session.page.getPageNum()}]]==[[${session.page.getPages()}]]){
                $("#a3").hide();
            }
        })
    </script>
</head>
<body>
<div id="d1">
    <p>
        <center>
            <form action="showAll" >
                <label>帖子标题：</label>
                <input name="str" th:value="${session.select}">
                <button>搜索</button>
            </form>
        </center>
    </p>
    <table border="1"  id="tab">
        <tr style="background-color: darkslateblue">
            <td>标题</td>
            <td>内容</td>
            <td>作者</td>
            <td>时间</td>
            <td>操作</td>
        </tr>
    </table>
    <p>
        <a th:href="@{showAll(index=1,str=${session.select})}">首&nbsp;&nbsp;页</a>
        <a id="a2" th:href="@{showAll(index=${session.page.getPageNum()-1},str=${session.select})}">上一页</a>
        <a id="a3" th:href="@{showAll(index=${session.page.getPageNum()+1},str=${session.select})}">下一页</a>
        <a th:href="@{showAll(index=${session.page.getPages()},str=${session.select})}">末&nbsp;&nbsp;页</a>
    </p>
</div>
</body>
</html>